/* Copyright (C) 2010 Fredrique Samuels, fredriquesamuels@gmail.com */

/*
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef TRI_TRANSFORM_H_
#define TRI_TRANSFORM_H_

#include <string>
#include <map>

#include "base/animate.h"
#include "base/vector.h"
#include "base/matrix.h"
#include "graphics.h"

namespace tri {

/**
 * Defines the location, rotation, size and scale of
 * rendered objects
 */
class TTransform{
public:
	TTransform();
	virtual ~TTransform();
	
	//transform
	void setPosition(tri::TVector v);
	void setRotation(tri::TVector v);
	void setSize(tri::TVector v);
	void setScale(tri::TVector v);
	
	void setTargetPosition(tri::TVector v,float t);
	void setTargetRotation(tri::TVector v,float t);
	void setTargetSize(tri::TVector v,float t);
	void setTargetScale(tri::TVector v,float t);
	
	void setPosition(float x, float y, float z=0);
	void setRotation(float x, float y, float z=0);
	void setSize(float x, float y, float z=1);
	void setScale(float x, float y, float z=1);
	
	tri::TVector getPosition();
	tri::TVector getRotation();
	tri::TVector getSize();
	tri::TVector getScale();
	
	tri::TMatrix getModelMatrix();
	
	//display settings
	void setWireFrameMode(bool b);
	void setInverseTransform(bool b);
	
	bool isWireFrameMode();

	void applyTransform();
	
private:
	
	//transforms
	tri::TAniVector m_Pos;
	tri::TAniVector m_Rot;
	tri::TAniVector m_Size;
	tri::TAniVector m_Scale;
	
	tri::TMatrix m_ModelMatrix;
	
	//display settings
	bool m_WireFrameMode;
	bool m_InverseTransform;
};

}

#endif /*TRI_TRANSFORM_H_*/
